//
//  TPButton.m
//  CloudAtCostPanel
//
//  Created by leonardo on 2017/1/26.
//  Copyright © 2017年 tanpengsccd. All rights reserved.
//

#import "TPButton.h"

#import "TPUIMacro.h"
@implementation TPButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

/**
*  普通btn
*
*  @param titleStr <#titleStr description#>
*
*  @return <#return value description#>
*/
- (instancetype)initwithNomalBtnTitleStr:(NSString *)titleStr{
    return [self initWithTitleStr:titleStr titleColor:COLOUR_WHITE titleFont:FONTSIZE_TITLE bgColor:COLOUR_BLUE cornerRadius:CORNER_RADIUS];
}


/**
 *  
 *
 *  @param titleStr     <#titleStr description#>
 *  @param titleColor   <#titleColor description#>
 *  @param titleFont    <#titleFont description#>
 *  @param bgcolor      <#bgcolor description#>
 *  @param cornerRadius <#cornerRadius description#>
 *
 *  @return <#return value description#>
 */
- (instancetype)initWithTitleStr:(NSString *) titleStr titleColor:(UIColor *)titleColor titleFont:(UIFont *)titleFont bgColor:(UIColor *)bgcolor cornerRadius:(CGFloat)cornerRadius{
    
    self = [super init];
    if (self) {
//        self.tintColor = titleColor;
//        self.titleLabel.text = titleStr;
//        self.titleLabel.textColor = titleColor;
        [self setTitle:titleStr forState:UIControlStateNormal];
        [self setTitleColor:titleColor forState:UIControlStateNormal];
        self.titleLabel.font = titleFont;
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.backgroundColor = bgcolor;
        self.layer.cornerRadius = cornerRadius;
    }
    return self;
    
}
@end
